<template>
  <div class="modal" v-if="value">
    <div class="modal-content">
      <div class="modal-header">
        <h3>支付二维码</h3>
        <span class="close" @click="$emit('close')">&times;</span>
      </div>
      <div class="modal-body">
        <qrcode :value="value" :size="200" />
        <p class="payment-info">请使用微信或支付宝扫描二维码完成支付</p>
      </div>
    </div>
  </div>
</template>

<script>
import { Qrcode } from 'qrcode.vue';

export default {
  name: 'QrcodeModal',
  components: {
    Qrcode
  },
  props: {
    value: {
      type: String,
      required: true
    }
  }
}
</script>

<style scoped>
.modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.close {
  cursor: pointer;
  font-size: 24px;
  color: #666;
}

.close:hover {
  color: #333;
}

.modal-body {
  text-align: center;
}

.payment-info {
  color: #666;
  margin-top: 15px;
  font-size: 14px;
}
</style> 